import Vue from 'vue';
import VueRouter from 'vue-router';
import home from '../views/index.vue';

Vue.use(VueRouter);

const routes = [
  {
    path: '/home',
    name: 'home',
    component: home,
  },
  {
    path: '/user',
    name: 'user',
    component: () => import('../socket/user.vue'),
  },
  {
    path: '/login',
    name: 'login',
    component: () => import('../login.vue'),
  },
  {
    path: '/kefu',
    name: 'kefu',
    component: () => import('../socket/kefu.vue'),
    redirect: 'index',
    children: [
      {
        path: '/index',
        name: 'index',
        component: () => import('../socket/components/index.vue'),
      },
      {
        path: '/msg',
        name: 'msg',
        component: () => import('../socket/components/msg.vue'),
      },
    ]
  },
  {
    path: '/zhandian',
    name: 'zhandian',
    component: () => import('../views/zhandian.vue'),
  },
  {
    path: '/zanzhu',
    name: 'zanzhu',
    component: () => import('../views/zanzhu.vue'),
  },
  {
    path: '/guanyu',
    name: 'guanyu',
    component: () => import('../views/guanyu.vue'),
  },
];

const router = new VueRouter({
  mode: 'hash',
  base: process.env.BASE_URL,
  routes,
});

export default router;
